﻿<%@ Page Language="C#" MasterPageFile="~/promo/promotion.master" AutoEventWireup="true" CodeFile="rsa-june-travel-insurance.aspx.cs" Inherits="promo_rsa_june_travel_insurance" %>


<%@ Register Src="~/controls/usrPhoneNo.ascx" TagName="usrPhoneNo" TagPrefix="uc1" %>
<%@ Register Src="~/controls/usrDate.ascx" TagName="usrDate" TagPrefix="uc2" %>
<%@ Register Src="~/controls/usrNoJS.ascx" TagName="usrNoJS" TagPrefix="ucNoJS" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
  <!--Start Page Title, Keywords, Description-->
    <!--Check server side (title, keywords, description) creating source code on Page_Load-->
    <asp:Label ID="lblPageTile" Text="RSA Singapore Travel Insurance Promotion " runat="server" Visible="false"></asp:Label>
    <asp:Label ID="lblKeywords" Text="travel insurance, single trip, annual multi traveling, rsa singapore" runat="server" Visible="false"></asp:Label>
    <asp:Label ID="lblDescription" Text="30% off single trips and 20% off annual travel insurance plans. You can buy now and travel later to take advantage of this promotion."
        runat="server" Visible="false"></asp:Label>
    <!--END Page Title, Keywords, Description-->
    <script type="text/javascript" src="../../js/jquery-1.5.1.js"></script>
    <script type="text/javascript" src="../../js/jquery.ui.datepicker.js"></script>
    <script type="text/javascript" src="../../js/jquery.ui.core.js"></script>
    <script type="text/javascript" src="../../js/jquery.ui.widget.js"></script>
    <asp:ScriptManager ID="ScriptManager" runat="server">
    </asp:ScriptManager>

    <div class="elements_inner_wrapper">
        <div id="contentBody_full">
            <h1><strong>RSA Singapore Travel Insurance Promotion - June 2012</strong></h1>
            <div class="promo_btex">
                <div class="proleft left">
                    <div class="propad15">
                        <img src="/images/promo/RSA_banner.png" alt="RSA Travel Insurance Promotion" width="633" height="187" />
                    </div>
                    <div class="clear"></div>
                    <div class="prohigh">
                        <p class="propad15">You can buy now and travel later (up to 3 months in advance) to take advantage of the promotion.</p>
                    </div>
                    <div class="propad15">
                        <img src="/images/bg/key_b.png" alt="Key Benefits" width="111" height="16" />
                        <ul>
                            <li>Offers Immediate 24-hour online enrolment, payment and confirmation via your personal email</li>
                            <li>3 Plans to choose from with cover of up to $1,000,000 for Personal Accident and $500,000 for Overseas Medical Expenses</li>
                            <li>Covers up to 182 days per single trip policy and up to 90 days per trip under the Annual Plan</li>
                            <li>Covers post journey medical expense indemnity of up to $50,000</li>
                            <li>Covers Accidental Burns and Fractures and Traditional Chinese Medicine</li>
                            <li>Covers Travel Postponement, Rearrangement, Curtailment, Delay and Diversion due to Natural Disasters</li>
                            <li>Covers Travel Curtailment, Delay and Diversion due to Bomb Threat</li>
                            <li>Covers Flight Diversion due to Strike, Civil Unrest, Riot or Commotion, Inclement Weather, Bomb Threat or Natural Disasters</li>
                            <li>Covers delayed Baggage whilst Overseas or back to Singapore</li>
                            <li>Covers Jewellery</li>
                            <li>Covers Terrorism</li>
                        </ul>
                        <span>The above is not a contract of insurance.  Please refer to the Policy for terms and conditions.</span>
                        <div class="clear"></div>
                    </div>
                </div>
                <div class="proright right">
                    <div class="propad15">
                    
                        <div id="divtravelsearch">
                            <div class="section">
                                <fieldset>
                                
                                    <div class="row_new">
                                        <asp:ValidationSummary ID="ValidationSummary1" HeaderText="Oops Please complete the form."
                                            runat="server" ValidationGroup="travel_insurance" CssClass="errorSummary" />
                                    </div>
                                    
                                    <label>Trip Type</label>
                                    <input type="hidden" name="snum" id="snum" runat="server" visible="true" />
                                    <asp:DropDownList ID="ddlTripType" onchange="ChangeScenario();" runat="server" class="text"
                                        Width="246px">
                                        <asp:ListItem Selected="True" Value="-1">Select</asp:ListItem>
                                        <asp:ListItem Value="S">Single Trip</asp:ListItem>
                                        <asp:ListItem Value="A">Annual Multi-Trip</asp:ListItem>
                                    </asp:DropDownList>
                                    <asp:RequiredFieldValidator ID="rfvTripType" InitialValue="-1" runat="server" ControlToValidate="ddlTripType"
                                        CssClass="validationErrorControl" ErrorMessage="" ValidationGroup="travel_insurance"></asp:RequiredFieldValidator>
<%--                                    <span class="formInfo1" id="divTTTripType"><a href="../../tooltips/trip_type.htm?width=250"
                                    class="jTip" id="one">
                                    <img src="/images/icons/help.gif" alt="Help" width="16" height="18" style="vertical-align: middle;" /></a>--%>
                                    

                                    <label>Type of Policy</label>
                                    <asp:DropDownList ID="ddlPolicyType" onchange="ChangeScenario();" runat="server"
                                        class="text" Width="246px">
                                        <asp:ListItem Selected="True" Value="-1">Select</asp:ListItem>
                                        <asp:ListItem Value="IND">Individual</asp:ListItem>
                                       <%-- <asp:ListItem Value="INS">Individual + Spouse</asp:ListItem>--%>
                                        <asp:ListItem Value="FML">Family</asp:ListItem>
                                    </asp:DropDownList>                                
                                    <asp:RequiredFieldValidator ID="rfvPolicyType" InitialValue="-1" runat="server" ControlToValidate="ddlPolicyType"
                                        CssClass="validationErrorControl" ErrorMessage="" ValidationGroup="travel_insurance"></asp:RequiredFieldValidator>

                                    <div id="divSingleTrip" style="display: none">

                                        <label>Traveling from Singapore to:</label>
                                        <div>
                                            <div style="display: none;">
                                                <asp:DropDownList ID="ddlDestCountry" runat="server" class="text" Width="246px">
                                                </asp:DropDownList>
                                                <asp:RequiredFieldValidator ID="rfvDestCountry" InitialValue="-1" runat="server"
                                                    ControlToValidate="ddlDestCountry" CssClass="validationErrorControl" ErrorMessage=""
                                                    ValidationGroup="travel_insurance"></asp:RequiredFieldValidator></div>
                                            <asp:TextBox ID="txtCountry" runat="server" Width="238px" AutoCompleteType="Disabled"
                                                onfocus="disableautocompletion(this.id);"></asp:TextBox>
                                            <div id="divwidth"></div>
                                            <input id="inputSelCountryName" type="hidden" runat="server" />
                                            <asp:RequiredFieldValidator ID="rfvCountry" InitialValue="" runat="server" ControlToValidate="txtCountry"
                                                ErrorMessage="" ValidationGroup="travel_insurance" CssClass="validationErrorControl"></asp:RequiredFieldValidator>
                                            <cc1:AutoCompleteExtender ID="AutoCompleteExtender1" runat="server" TargetControlID="txtCountry"
                                                FirstRowSelected="true" MinimumPrefixLength="1" ServicePath="~/travel-insurance/travel_webservice.asmx"
                                                EnableCaching="true" CompletionSetCount="10" CompletionInterval="1000" ServiceMethod="GetCountries"
                                                OnClientPopulating="ShowProcessImage" OnClientPopulated="HideProcessImage" OnClientItemSelected="SelectedCountry"
                                                CompletionListCssClass="AutoExtender" CompletionListItemCssClass="AutoExtenderList"
                                                CompletionListHighlightedItemCssClass="AutoExtenderHighlight" CompletionListElementID="divwidth">
                                            </cc1:AutoCompleteExtender>
                                        </div>

                                        <label>Travel Start Date</label>
                                        <input id="from" name="from" type="text" readonly="readonly" style="width:150px;" />
                                        <input id="inputFrom" type="hidden" runat="server" />
 
                                        <label>Travel End Date</label>
                                        <input id="to" name="to" type="text" readonly="readonly" style="width:150px;" />
                                        <input id="inputTo" type="hidden" runat="server" />
         
                                    </div>
                                    
                                    <div id="divAnnualTrip" style="display: none">

                                        <label>Region to travel</label>
                                        <asp:DropDownList ID="ddlDestRegion" runat="server" class="text" Width="150px"></asp:DropDownList>
                                        <asp:RequiredFieldValidator ID="rfvDestRegion" InitialValue="-1" runat="server" ControlToValidate="ddlDestRegion"
                                            CssClass="validationErrorControl" ErrorMessage="" ValidationGroup="travel_insurance"></asp:RequiredFieldValidator>
          
                                        <label>Policy Commencement Date</label>
                                        <input id="annualcomdate" name="annualcomdate" type="text" readonly="readonly" style="width:141px;" />
                                        <input id="inputannualcomdate" type="hidden" runat="server" />

                                    </div>
                                    
                                    <div id="divIndividual" style="display: none">                                    
                                        <label>Birthday</label>
                                        <uc2:usrDate ID="usrBirthday" ValidationGroup="travel_insurance" runat="server" />
                                    </div>
                                    
                                    <div id="divIndividualSpouse" style="display: none">
                                        <label>Spouse's Birthday</label>
                                        <uc2:usrDate ID="usrBirthdaySpouse" ValidationGroup="travel_insurance" runat="server" />
                                    </div>
                                    
                                     <div id="divFamily" style="display: none">
                                     
                                        <div id="divNoOfAdults">
                                            <label>Number of adults</label>
                                            <asp:DropDownList ID="ddlNoOfAdults" onchange="AdultDOBShowHide();AdultDOBValidation();"
                                                runat="server" class="text" Width="150px">
                                                <asp:ListItem Selected="True" Value="0">Select</asp:ListItem>
                                                <asp:ListItem Value="1">1</asp:ListItem>
                                                <asp:ListItem Value="2">2</asp:ListItem>
                                            </asp:DropDownList>
                                            <asp:RequiredFieldValidator ID="rfvNoOfAdults" InitialValue="0" runat="server" ControlToValidate="ddlNoOfAdults"
                                                CssClass="validationErrorControl" ErrorMessage="" ValidationGroup="travel_insurance"></asp:RequiredFieldValidator>
                                        </div>
                                        
                                        <div id="divAdult1">
                                            <label>Date of Birth (Adult 1)</label>
                                            <uc2:usrDate ID="usrAdult1DOB" ValidationGroup="travel_insurance" runat="server" />
                                        </div>
                                        
                                        <div class="row_new" id="divAdult2">
                                            <label>Date of Birth (Adult 2)</label>
                                            <uc2:usrDate ID="usrAdult2DOB" ValidationGroup="travel_insurance" runat="server" />
                                        </div>
                                        
                                        <div id="divNoOfChild">
                                            <label>No of Children:<br />
                                                (Child 18-25 must be full-time student)
                                            </label>

                                            <asp:DropDownList ID="ddlNoOfChilds" onchange="ChildDOBShowHide();ChildDOBValidation();"
                                                runat="server" class="text" Width="150">
                                                <asp:ListItem Selected="True" Value="0">Select</asp:ListItem>
                                                <asp:ListItem Value="1">1</asp:ListItem>
                                                <asp:ListItem Value="2">2</asp:ListItem>
                                                <asp:ListItem Value="3">3</asp:ListItem>
                                                <asp:ListItem Value="4">4</asp:ListItem>
                                                <asp:ListItem Value="5">5</asp:ListItem>
                                                <asp:ListItem Value="6">6</asp:ListItem>
                                            </asp:DropDownList>
                                            <asp:RequiredFieldValidator ID="rfvNoOfChilds" InitialValue="0" runat="server" ControlToValidate="ddlNoOfChilds"
                                                CssClass="validationErrorControl" ErrorMessage="" ValidationGroup="travel_insurance"></asp:RequiredFieldValidator>

                                        </div>
                                        
                                        <div id="divChild1">
                                            <label>Date of Birth (Child 1)</label>
                                            <uc2:usrDate ID="usrChild1DOB" ValidationGroup="travel_insurance" runat="server" />
<%--                                        <span class="formInfo1"><a href="../../tooltips/child_age.htm?width=250" class="jTip"
                                            id="A15">
                                            <img src="/images/icons/help.gif" alt="Help" style="vertical-align: middle" width="16"
                                                height="18" /></a></span>--%>
                                        </div>
                                        <div id="divChild2">
                                            <label>Date of Birth (Child 2)</label>
                                            <uc2:usrDate ID="usrChild2DOB" ValidationGroup="travel_insurance" runat="server" />
<%--                                            <span class="formInfo1">
                                                <a href="../../tooltips/child_age.htm?width=250" class="jTip" id="A16">
                                                <img src="/images/icons/help.gif" alt="Help" style="vertical-align: middle" width="16" height="18" /></a>
                                            </span>--%>
                                        </div>
                                        <div id="divChild3">
                                            <label>Date of Birth (Child 3)</label>
                                            <uc2:usrDate ID="usrChild3DOB" ValidationGroup="travel_insurance" runat="server" />
<%--                                            <span class="formInfo1"><a href="../../tooltips/child_age.htm?width=250" class="jTip"
                                                id="A17">
                                                <img src="/images/icons/help.gif" alt="Help" style="vertical-align: middle" width="16"
                                                    height="18" /></a>
                                            </span>--%>
                                        </div>
                                        <div id="divChild4">
                                            <label>Date of Birth (Child 4)</label>
                                            <uc2:usrDate ID="usrChild4DOB" ValidationGroup="travel_insurance" runat="server" />
<%--                                            <span class="formInfo1"><a href="../../tooltips/child_age.htm?width=250" class="jTip"
                                                    id="A18">
                                                    <img src="/images/icons/help.gif" alt="Help" style="vertical-align: middle" width="16"
                                                        height="18" /></a>
                                            </span>--%>
                                        </div>
                                        <div id="divChild5">
                                            <label>Date of Birth (Child 5)</label>
                                            <uc2:usrDate ID="usrChild5DOB" ValidationGroup="travel_insurance" runat="server" />
<%--                                            <span class="formInfo1"><a href="../../tooltips/child_age.htm?width=250" class="jTip"
                                                    id="A19">
                                                    <img src="/images/icons/help.gif" alt="Help" style="vertical-align: middle" width="16"
                                                        height="18" /></a>
                                            </span>--%>
                                        </div>
                                        <div id="divChild6">
                                            <label>Date of Birth (Child 6)</label>
                                            <uc2:usrDate ID="usrChild6DOB" ValidationGroup="travel_insurance" runat="server" />
<%--                                          <span class="formInfo1"><a href="../../tooltips/child_age.htm?width=250" class="jTip"
                                                    id="A20">
                                                    <img src="/images/icons/help.gif" alt="Help" style="vertical-align: middle" width="16"
                                                        height="18" /></a>
                                            </span>--%>
                                        </div>
                                    </div>
                                    <div id="divFamilySingle" style="display: none">
                                    
                                        <div id="divNoOfAdultsSingle">
                                            <label>Number of adults</label>
                                            <asp:DropDownList ID="ddlNoOfAdultsSingle" onchange="AdultDOBSingleShowHide();AdultDOBSingleValidation();"
                                                runat="server" class="text" Width="150">
                                                <asp:ListItem Selected="True" Value="0">Select</asp:ListItem>
                                                <asp:ListItem Value="1">1</asp:ListItem>
                                                <asp:ListItem Value="2">2</asp:ListItem>
                                            </asp:DropDownList>
                                            <asp:RequiredFieldValidator ID="rfvNoOfAdultsSingle" InitialValue="0" runat="server"
                                                ControlToValidate="ddlNoOfAdultsSingle" CssClass="validationErrorControl" ErrorMessage=""
                                                ValidationGroup="travel_insurance"></asp:RequiredFieldValidator>             
                                        </div>
                                        
                                        <div id="divAdultSingle1">
                                            <label>Date of Birth (Adult 1)</label>
                                            <uc2:usrDate ID="usrAdult1DOBSingle" ValidationGroup="travel_insurance" runat="server" />
                                        </div>
                                        <div id="divAdultSingle2">
                                            <label>Date of Birth (Adult 2)</label>
                                            <uc2:usrDate ID="usrAdult2DOBSingle" ValidationGroup="travel_insurance" runat="server" />
                                        </div>
                                        <div id="divNoOfChildSingle">
                                            <label>No of Children:<br />
                                                (Child 18-25 must be full-time student)
                                            </label>
                                            <asp:DropDownList ID="ddlNoOfChildsSingle" onchange="ChildDOBSingleShowHide();ChildDOBSingleValidation();"
                                                runat="server" class="text" Width="150">
                                                <asp:ListItem Selected="True" Value="0">Select</asp:ListItem>
                                                <asp:ListItem Value="1">1</asp:ListItem>
                                                <asp:ListItem Value="2">2</asp:ListItem>
                                                <asp:ListItem Value="3">3</asp:ListItem>
                                                <asp:ListItem Value="4">4</asp:ListItem>
                                            </asp:DropDownList>
                                            <asp:RequiredFieldValidator ID="rfvNoOfChildsSingle" InitialValue="0" runat="server"
                                                ControlToValidate="ddlNoOfChildsSingle" CssClass="validationErrorControl" ErrorMessage=""
                                                ValidationGroup="travel_insurance"></asp:RequiredFieldValidator>
                                        </div>
                                        <div id="divChildSingle1">
                                            <label>Date of Birth (Child 1)</label>
                                            <uc2:usrDate ID="usrChild1DOBSingle" ValidationGroup="travel_insurance" runat="server" />
                    <%--                        <span class="formInfo1"><a href="../../tooltips/child_age.htm?width=250" class="jTip"
                                                id="A3">
                                                <img src="/images/icons/help.gif" alt="Help" style="vertical-align: middle" width="16"
                                                    height="18" /></a>
                                             </span>--%>
                                        </div>
                                        <div id="divChildSingle2">
                                            <label>Date of Birth (Child 2)</label>
                                            <uc2:usrDate ID="usrChild2DOBSingle" ValidationGroup="travel_insurance" runat="server" />
<%--                                            <span class="formInfo1"><a href="../../tooltips/child_age.htm?width=250" class="jTip"
                                                id="A4">
                                                <img src="/images/icons/help.gif" alt="Help" style="vertical-align: middle" width="16"
                                                    height="18" /></a>
                                             </span>--%>
                                        </div>
                                        <div id="divChildSingle3">
                                            <label>Date of Birth (Child 3)</label>
                                            <uc2:usrDate ID="usrChild3DOBSingle" ValidationGroup="travel_insurance" runat="server" />
<%--                                            <span class="formInfo1"><a href="../../tooltips/child_age.htm?width=250" class="jTip"
                                            id="A5">
                                            <img src="/images/icons/help.gif" alt="Help" style="vertical-align: middle" width="16"
                                                height="18" /></a>
                                            </span>--%>
                                        </div>
                                        <div id="divChildSingle4">
                                            <label>Date of Birth (Child 4)</label>
                                            <uc2:usrDate ID="usrChild4DOBSingle" ValidationGroup="travel_insurance" runat="server" />
<%--                                            <span class="formInfo1"><a href="../../tooltips/child_age.htm?width=250" class="jTip"
                                                    id="A6">
                                                    <img src="/images/icons/help.gif" alt="Help" style="vertical-align: middle" width="16"
                                                        height="18" /></a>
                                            </span>--%>
                                        </div>
                                    </div>
                                </fieldset>
                                <div class="quickq_btn"> 
                                    <asp:Button runat="server" ID="btnNext" onmousedown="this.className = 'button_nquote_mousedown';"
                                        onmouseup="this.className = 'button_nquote';" onmouseout="this.className = 'button_nquote';"
                                        CssClass="button_nquote" ValidationGroup="travel_insurance" OnClientClick="LoadValidationErrorCss();if (checkValidation()){this.removeAttribute('onmouseout');this.removeAttribute('onmouseup');this.className = 'button_processing';}else{return false;}"
                                        OnClick="imgbtnSearch_Click" />
                                    <div class="clear"></div>
                                </div>
                                <div class="clear"></div>
                                <div style="display: none;">
                                    <input id="inputPID" runat="server" />
                                </div>
                            </div>

                        </div>
                        
                    </div>
                </div>
                <div class="clear"></div>
            </div>
            <div class="clear"></div>
            
        </div>
    </div>

    <script type="text/javascript">
           //<![CDATA[

           //        Sys.WebForms.PageRequestManager.getInstance().add_endRequest(endRequestHandler);
           //        function endRequestHandler() {
           //            javascript:JT_init();
           //        }

           /*function JT_init() {
           $("a.jTip")
           .hover(function() { JT_show(this.href, this.id, this.name) }, function() { $('#JT').remove() })
           .click(function() { return false });
           }*/

           function ShowHideDiv(divName, varOnOff) {
               if (varOnOff) {
                   document.getElementById(divName).style.display = "";
               }
               else {
                   document.getElementById(divName).style.display = "none";
               }
           }

           function SingleTripValidationState(onOff) {
               ValidatorEnable(document.getElementById('<%=rfvDestCountry.ClientID%>'), onOff);
               ValidatorEnable(document.getElementById('<%=rfvCountry.ClientID%>'), onOff);


           }

           function AnnualTripValidationState(onOff) {
               ValidatorEnable(document.getElementById('<%=rfvDestRegion.ClientID%>'), onOff);

           }

           function IndividualValidationState(onOff) {
               IsEnableDateValidation('<%=usrBirthday.ClientID%>', onOff);
           }

           function IndividualSpouseValidationState(onOff) {
               IsEnableDateValidation('<%=usrBirthday.ClientID%>', onOff);
               IsEnableDateValidation('<%=usrBirthdaySpouse.ClientID%>', onOff);
           }

           function FamilyValidationState(onOff) {
               ValidatorEnable(document.getElementById('<%=rfvNoOfAdults.ClientID%>'), onOff);
               document.getElementById('<%=ddlNoOfAdults.ClientID%>').value = "-1";
               AdultDOBShowHide();
               AdultDOBValidation();

               ValidatorEnable(document.getElementById('<%=rfvNoOfChilds.ClientID%>'), onOff);
               document.getElementById('<%=ddlNoOfChilds.ClientID%>').value = "-1";
               ChildDOBShowHide();
               ChildDOBValidation();
           }

           function FamilySingleTripValidationState(onOff) {
               ValidatorEnable(document.getElementById('<%=rfvNoOfAdultsSingle.ClientID%>'), onOff);
               document.getElementById('<%=ddlNoOfAdultsSingle.ClientID%>').value = "-1";
               AdultDOBSingleShowHide();
               AdultDOBSingleValidation();


               ValidatorEnable(document.getElementById('<%=rfvNoOfChildsSingle.ClientID%>'), onOff);
               document.getElementById('<%=ddlNoOfChildsSingle.ClientID%>').value = "-1";

               ChildDOBSingleShowHide();
               ChildDOBSingleValidation();
           }

           function AdultDOBValidation() {
               var _count = document.getElementById('<%=ddlNoOfAdults.ClientID%>').value;

               var usrAdult1DOB = "<%=usrAdult1DOB.ClientID%>";
               var usrAdult2DOB = "<%=usrAdult2DOB.ClientID%>";

               if (_count == 0 || document.getElementById('divFamily').style.display == 'none') {
                   IsEnableDateValidation(usrAdult1DOB, false);
                   IsEnableDateValidation(usrAdult2DOB, false);

               }
               else {
                   for (var i = 1; i <= 3; i++) {
                       if (_count > 0) IsEnableDateValidation(usrAdult1DOB, true);
                       else IsEnableDateValidation(usrAdult1DOB, false);

                       if (_count > 1) IsEnableDateValidation(usrAdult2DOB, true);
                       else IsEnableDateValidation(usrAdult2DOB, false);

                   }
               }
           }

           function AdultDOBSingleValidation() {
               var _count = document.getElementById('<%=ddlNoOfAdultsSingle.ClientID%>').value;

               var usrAdult1DOB = "<%=usrAdult1DOBSingle.ClientID%>";
               var usrAdult2DOB = "<%=usrAdult2DOBSingle.ClientID%>";

               if (_count == 0 || document.getElementById('divFamilySingle').style.display == 'none') {
                   IsEnableDateValidation(usrAdult1DOB, false);
                   IsEnableDateValidation(usrAdult2DOB, false);

               }
               else {
                   for (var i = 1; i <= 3; i++) {
                       if (_count > 0) IsEnableDateValidation(usrAdult1DOB, true);
                       else IsEnableDateValidation(usrAdult1DOB, false);

                       if (_count > 1) IsEnableDateValidation(usrAdult2DOB, true);
                       else IsEnableDateValidation(usrAdult2DOB, false);

                   }
               }
           }

           function ChildDOBValidation() {
               var _count = document.getElementById('<%=ddlNoOfChilds.ClientID%>').value;

               var usrChild1DOB = "<%=usrChild1DOB.ClientID%>";
               var usrChild2DOB = "<%=usrChild2DOB.ClientID%>";
               var usrChild3DOB = "<%=usrChild3DOB.ClientID%>";
               var usrChild4DOB = "<%=usrChild4DOB.ClientID%>";
               var usrChild5DOB = "<%=usrChild5DOB.ClientID%>";
               var usrChild6DOB = "<%=usrChild6DOB.ClientID%>";

               if (_count == 0 || document.getElementById('divFamily').style.display == 'none') {
                   IsEnableDateValidation(usrChild1DOB, false);
                   IsEnableDateValidation(usrChild2DOB, false);
                   IsEnableDateValidation(usrChild3DOB, false);
                   IsEnableDateValidation(usrChild4DOB, false);
                   IsEnableDateValidation(usrChild5DOB, false);
                   IsEnableDateValidation(usrChild6DOB, false);

               }
               else {
                   for (var i = 1; i <= 6; i++) {
                       if (_count > 0) IsEnableDateValidation(usrChild1DOB, true);
                       else IsEnableDateValidation(usrChild1DOB, false);

                       if (_count > 1) IsEnableDateValidation(usrChild2DOB, true);
                       else IsEnableDateValidation(usrChild2DOB, false);

                       if (_count > 2) IsEnableDateValidation(usrChild3DOB, true);
                       else IsEnableDateValidation(usrChild3DOB, false);

                       if (_count > 3) IsEnableDateValidation(usrChild4DOB, true);
                       else IsEnableDateValidation(usrChild4DOB, false);

                       if (_count > 4) IsEnableDateValidation(usrChild5DOB, true);
                       else IsEnableDateValidation(usrChild5DOB, false);

                       if (_count > 5) IsEnableDateValidation(usrChild6DOB, true);
                       else IsEnableDateValidation(usrChild6DOB, false);
                   }
               }
           }

           function ChildDOBSingleValidation() {
               var _count = document.getElementById('<%=ddlNoOfChildsSingle.ClientID%>').value;

               var usrChild1DOB = "<%=usrChild1DOBSingle.ClientID%>";
               var usrChild2DOB = "<%=usrChild2DOBSingle.ClientID%>";
               var usrChild3DOB = "<%=usrChild3DOBSingle.ClientID%>";
               var usrChild4DOB = "<%=usrChild4DOBSingle.ClientID%>";

               if (_count == 0 || document.getElementById('divFamilySingle').style.display == 'none') {
                   IsEnableDateValidation(usrChild1DOB, false);
                   IsEnableDateValidation(usrChild2DOB, false);
                   IsEnableDateValidation(usrChild3DOB, false);
                   IsEnableDateValidation(usrChild4DOB, false);
               }
               else {
                   for (var i = 1; i <= 5; i++) {
                       if (_count > 0) IsEnableDateValidation(usrChild1DOB, true);
                       else IsEnableDateValidation(usrChild1DOB, false);

                       if (_count > 1) IsEnableDateValidation(usrChild2DOB, true);
                       else IsEnableDateValidation(usrChild2DOB, false);

                       if (_count > 2) IsEnableDateValidation(usrChild3DOB, true);
                       else IsEnableDateValidation(usrChild3DOB, false);

                       if (_count > 3) IsEnableDateValidation(usrChild4DOB, true);
                       else IsEnableDateValidation(usrChild4DOB, false);

                   }
               }
           }

           function AdultDOBShowHide() {
               var _count = document.getElementById('<%=ddlNoOfAdults.ClientID%>').value;
               //alert(_count);
               for (var i = 1; i <= 2; i++) {
                   if (_count >= i)
                       ShowHideDiv('divAdult' + i.toString(), true);
                   else
                       ShowHideDiv('divAdult' + i.toString(), false);
               }
           }

           function AdultDOBSingleShowHide() {
               var _count = document.getElementById('<%=ddlNoOfAdultsSingle.ClientID%>').value;
               //alert(_count);
               for (var i = 1; i <= 2; i++) {
                   if (_count >= i)
                       ShowHideDiv('divAdultSingle' + i.toString(), true);
                   else
                       ShowHideDiv('divAdultSingle' + i.toString(), false);
               }
           }

           function ChildDOBShowHide() {
               var _count = document.getElementById('<%=ddlNoOfChilds.ClientID%>').value;
               //alert(_count);
               for (var i = 1; i <= 6; i++) {
                   if (_count >= i)
                       ShowHideDiv('divChild' + i.toString(), true);
                   else
                       ShowHideDiv('divChild' + i.toString(), false);
               }
           }

           function ChildDOBSingleShowHide() {
               var _count = document.getElementById('<%=ddlNoOfChildsSingle.ClientID%>').value;
               //alert(_count);
               for (var i = 1; i <= 4; i++) {
                   if (_count >= i)
                       ShowHideDiv('divChildSingle' + i.toString(), true);
                   else
                       ShowHideDiv('divChildSingle' + i.toString(), false);
               }
           }

           function ChangeScenario() {
               var ddlTripType = document.getElementById('<%=ddlTripType.ClientID%>');
               var ddlPolicyType = document.getElementById('<%=ddlPolicyType.ClientID%>');

               ShowHideDiv('divSingleTrip', false);
               ShowHideDiv('divAnnualTrip', false);
               ShowHideDiv('divIndividual', false);
               ShowHideDiv('divIndividualSpouse', false);
               ShowHideDiv('divFamily', false);
               ShowHideDiv('divFamilySingle', false);

               SingleTripValidationState(false);
               AnnualTripValidationState(false);
               IndividualValidationState(false);
               IndividualSpouseValidationState(false);
               FamilyValidationState(false);
               FamilySingleTripValidationState(false);

               if (ddlTripType.value == 'S') {

                   ShowHideDiv('divSingleTrip', true);
                   SingleTripValidationState(true);
                   //document.getElementById('<%=snum.ClientID%>').value = '1';
                   //alert(document.getElementById('<%=inputFrom.ClientID%>').value);
                   if (document.getElementById('<%=inputFrom.ClientID%>').value != '') {
                       document.getElementById('from').value = document.getElementById('<%=inputFrom.ClientID%>').value;
                   }

                   if (document.getElementById('<%=inputTo.ClientID%>').value != '') {
                       document.getElementById('to').value = document.getElementById('<%=inputTo.ClientID%>').value;
                   }

                   if (document.getElementById('<%=inputSelCountryName.ClientID%>').value != "") {
                       document.getElementById('<%=txtCountry.ClientID%>').value = document.getElementById('<%=inputSelCountryName.ClientID%>').value;
                   }
               }
               else if (ddlTripType.value == 'A') {

                   ShowHideDiv('divAnnualTrip', true);
                   AnnualTripValidationState(true);

                   if (document.getElementById('<%=inputFrom.ClientID%>').value != '') {
                       document.getElementById('annualcomdate').value = document.getElementById('<%=inputannualcomdate.ClientID%>').value;
                   }

                   //document.getElementById('<%=snum.ClientID%>').value = '2';
                   //alert('test ' + document.getElementById('<%=snum.ClientID%>').value);
               }

               if (ddlPolicyType.value == 'IND') {

                   ShowHideDiv('divIndividual', true);
                   IndividualValidationState(true);
               }
               else if (ddlPolicyType.value == 'FML') {

                   if (ddlTripType.value == 'S') {
                       ShowHideDiv('divFamilySingle', true);
                       FamilySingleTripValidationState(true);
                   }
                   else {
                       ShowHideDiv('divFamily', true);
                       FamilyValidationState(true);
                   }

               }
               else if (ddlPolicyType.value == 'INS') {
                   ShowHideDiv('divIndividual', true);
                   ShowHideDiv('divIndividualSpouse', true);
                   IndividualSpouseValidationState(true);
               }

           }

           function PhoneNoLengthClientValidate(source, arguments) {
               if (arguments.Value.length != 0 && arguments.Value.length < 8) {
                   arguments.IsValid = false;
               } else {
                   arguments.IsValid = true;
               }
           }

           function CheckPhoneNoClientValidate(source, arguments) {
               var cval = parseInt(arguments.Value)
               if (isNaN(cval)) {
                   arguments.IsValid = false;
               } else {
                   var cstrVal = "" + cval + "";
                   if (cstrVal.length < 8) {
                       arguments.IsValid = false;
                   }
                   else if (cstrVal.charAt(0) != "6" &&
                        cstrVal.charAt(0) != "8" &&
                        cstrVal.charAt(0) != "9") {
                       arguments.IsValid = false;
                   }
                   else {
                       arguments.IsValid = true;
                   }
               }
           }


           $(function() {
               var dates = $("#from").datepicker({
                   showOn: 'both',
                   buttonImage: '/images/icon/calendar.gif',
                   buttonImageOnly: true,
                   //showAnim: 'slideDown',
                   defaultDate: "+1w",
                   changeMonth: true,
                   numberOfMonths: 2,
                   dateFormat: "dd/mm/yy",
                   //minDate: '+1d',
                   beforeShow: setFromRange,
                   onSelect: function(selectedDate) {
                       var option = this.id == "from" ? "minDate" : "maxDate",
					    instance = $(this).data("datepicker"),
					    date = $.datepicker.parseDate(
						    instance.settings.dateFormat ||
						    $.datepicker._defaults.dateFormat,
						    selectedDate, instance.settings);
                       dates.not(this).datepicker("option", option, date);

                   }
               });

               var dates = $("#to").datepicker({
                   showOn: 'both',
                   buttonImage: '/images/icon/calendar.gif',
                   buttonImageOnly: true,
                   defaultDate: "+1w",
                   changeMonth: true,
                   numberOfMonths: 2,
                   dateFormat: "dd/mm/yy",
                   //minDate: '+1d',
                   beforeShow: setToRange,
                   onSelect: function(selectedDate) {
                       var option = this.id == "from" ? "minDate" : "maxDate",
					    instance = $(this).data("datepicker"),
					    date = $.datepicker.parseDate(
						    instance.settings.dateFormat ||
						    $.datepicker._defaults.dateFormat,
						    selectedDate, instance.settings);
                       dates.not(this).datepicker("option", option, date);
                   }
               });


               function setToRange() {

                   var next183Days;
                   next183Days = $("#from").datepicker('getDate');
                   next183Days.setDate(next183Days.getDate() + 91);

                   var minDate = $("#from").datepicker('getDate');
                   var maxDate = next183Days;

                   return {

                       minDate: minDate,
                       maxDate: maxDate

                   }

               }

               function setFromRange() {

                   var fullDate = new Date();
                   fullDate.setDate(fullDate.getDate() + 1);

                   var min183Days;
                   min183Days = $("#to").datepicker('getDate');
                   min183Days.setDate(min183Days.getDate() - 91);

                   var minDate = min183Days;
                   var maxDate = $("#to").datepicker('getDate');

                   if (min183Days < fullDate) {
                       minDate = fullDate;
                   }


                   return {

                       minDate: minDate
                       //maxDate: maxDate

                   }

               }

           });

           $(function() {
               var dates = $("#annualcomdate").datepicker({
                   showOn: 'both',
                   buttonImage: '/images/icon/calendar.gif',
                   buttonImageOnly: true,
                   defaultDate: "+1w",
                   changeMonth: true,
                   numberOfMonths: 1,
                   dateFormat: "dd/mm/yy",
                   minDate: '+1d'

               });
           });



           function ValidateSearchFields() {

               if (document.getElementById('from').value == '') {
                   document.getElementById('from').className = 'inputValidation';
                   return false;
               }
               else {
                   document.getElementById('from').className = '';
               }

               if (document.getElementById('to').value == '') {
                   document.getElementById('to').className = 'inputValidation';
                   return false;
               }
               else {
                   document.getElementById('to').className = '';
               }

               return true
           }

           function checkValidation() {

               if (Page_ClientValidate('travel_insurance')) {

                   if (document.getElementById('divSingleTrip').style.display != 'none') {
                       var isvalid = new Boolean(ValidateSearchFields());
                       if (isvalid.toString() == 'true') {
                           document.getElementById('<%=inputFrom.ClientID%>').value = document.getElementById('from').value;
                           document.getElementById('<%=inputTo.ClientID%>').value = document.getElementById('to').value;

                           if (document.getElementById('<%=txtCountry.ClientID%>').value == document.getElementById('<%=inputSelCountryName.ClientID%>').value) {
                               SingleTripValidationState(false);
                               return true;
                           }
                           else {
                               document.getElementById('<%=txtCountry.ClientID%>').className = 'validationError';

                           }
                       }
                   }
                   else {

                       document.getElementById('<%=inputannualcomdate.ClientID%>').value = document.getElementById('annualcomdate').value;
                       return true;
                   }


               }
               else {
                   if (document.getElementById('divSingleTrip').style.display != 'none') {
                       if (document.getElementById('<%=txtCountry.ClientID%>').value != document.getElementById('<%=inputSelCountryName.ClientID%>').value) {
                           document.getElementById('<%=txtCountry.ClientID%>').className = 'validationError';
                       }
                   }
                   return false;
               }

           }

           window.onload = function() {
               ChangeScenario();
           }

           function ShowProcessImage() {

               var autocomplete = document.getElementById('<%=txtCountry.ClientID%>');
               autocomplete.className = 'inputCountry';
               autocomplete.style.backgroundImage = 'url(../images/loader/small_loading.gif)';
               autocomplete.style.backgroundRepeat = 'no-repeat';
               autocomplete.style.backgroundPosition = 'right';
           }
           function HideProcessImage() {
               var autocomplete = document.getElementById('<%=txtCountry.ClientID%>');
               autocomplete.style.backgroundImage = 'none';
               autocomplete.className = 'inputCountry';
           }

           function SelectedCountry() {
               var autocomplete = document.getElementById('<%=txtCountry.ClientID%>');

               var dd = document.getElementById('<%=ddlDestCountry.ClientID%>');
               for (var i = 0; i < dd.options.length; i++) {
                   if (dd.options[i].text === autocomplete.value) {
                       dd.selectedIndex = i;
                       document.getElementById('<%=inputSelCountryName.ClientID%>').value = dd.options[i].text
                       break;
                   }
               }
           }

           function disableautocompletion(id) {
               var txtControl = document.getElementById(id);
               txtControl.setAttribute("autocomplete", "off");
           }


           //]]>
            
        
        </script>
    <script src="../../includes/travelinsurance/travelquote.js" type="text/javascript"></script>
</asp:Content>
